// server -> client

const net = require('net')

const server = net.createServer()

server.on('connection', socket => {
  console.log('server 已连接')
  socket.write('hello\r\n')
  socket.write('cwy\r\n')

  socket.end()
})

server.on('close', () => {
  console.log('server 已关闭')
})

server.listen(8888, function () {
  console.log('server 已绑定，监听端口8888')
})
